home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / ip / dns / rovers / Displays / xdisplay.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-04-24  |  17.2 KB  |  569 lines

  1. /*
  2.  *            X Based Display Program
  3.  */
  4. #include <stdio.h>
  5. #include <string.h>
  6. #include <sys/stat.h>
  7. #include <fcntl.h>
  8. #include <time.h>
  9. #include "../ProblemManager/ProblemManager.h"
  10. #include "../Ctools/ctools.h"
  11.  
  12. #include <Xm/Xm.h> 
  13. #include <X11/StringDefs.h>
  14. #include <X11/Intrinsic.h>
  15. #include <X11/Shell.h> 
  16. #include <Xm/Form.h> 
  17. #include <Xm/List.h> 
  18. #include <Xm/ToggleB.h> 
  19. #include <Xm/PushB.h> 
  20. #include <Xm/Label.h> 
  21. #include <Xm/Text.h> 
  22. #include <Xm/RowColumn.h> 
  23. #include <Xm/BulletinB.h> 
  24. #include <Xm/SelectioB.h> 
  25.  
  26. #define HUMANTIME 1
  27. #define ELAPSEDSEC 2
  28. #define ELAPSEDMIN 3
  29. #define LONGTIME 4
  30. int TimeStampFormat=HUMANTIME;
  31.  
  32. XmString *ProblemEntries;        /* Pointer to array of XmString*/
  33.  
  34. char *DefaultPingkyDir=".";
  35. char Checking_File[100];
  36. long checkinglasttime;
  37. char Problem_File[100];
  38. long problemfilelasttime;
  39. char CycleTime_File[100];
  40. long cycletimelasttime;
  41. char Log_File[100];
  42. char Host_File[100];
  43. long cycletimelasttime;
  44. char Filter_File[100];        /* File name of the filter pattern specs */
  45.  
  46. Widget lista,Myclock;
  47. Widget problemcounts,numproblems,cycletime,checkinglabel,checking;
  48.  
  49. #define MAXFILTERS 12
  50. struct Filters {
  51.     char *Name;        /* Name on PushButton */
  52.     char *RegExp;        /* NodeName Reg Exp   */
  53.     char *Pattern;        /* Compiled pattern   */
  54.     Boolean Selected;    /* Is this net selected*/
  55.     Widget Toggle;        /* Toggle Button    */
  56.     int count;        /* Count of items in net*/
  57.     Widget Count;        /* Test widget for counts*/
  58. } Filter[MAXFILTERS];
  59.  
  60. char *pingkydir, *getenv();
  61.  
  62. Widget helpdialog;
  63. static char *helptextstr=NULL;
  64.  
  65. SetupFilters()
  66. {
  67. FILE *stream;
  68. int i,line;
  69. static char inbuffer[MAXFILTERS][100];
  70. char buffer[200];
  71.  
  72.     for( i=0; i<MAXFILTERS; i++ ) Filter[i].Name=NULL;
  73.  
  74.     if ( ( stream = fopen( Filter_File, "r" )) == NULL ) return;
  75.  
  76.     for(i=0,line=1; fgets( inbuffer[i], 100, stream ) != NULL; line++) {
  77.         if (inbuffer[i][0] == '#' ) continue;
  78.         if ((Filter[i].Name=strtok(inbuffer[i]," \t\n"))==NULL) {
  79.             fprintf(stderr,"Blank Line  in filter file: %s line %d \n",Filter_File, line);
  80.             continue; /*BLANK*/
  81.         }
  82.  
  83.         if ((Filter[i].RegExp=strtok(NULL," \t\n"))==NULL) {
  84.             fprintf(stderr,"NULL Regular Expression in filterfile: %s line %d (%s)\n",Filter_File, line,Filter[i].Name );
  85.             Filter[i].Name=NULL;
  86.             continue;
  87.         }
  88.           if ( ( Filter[i].Pattern = regcmp( Filter[i].RegExp, NULL ) ) == NULL ) {
  89.             fprintf(stderr,"Error compiling %s regexp %s (%s)\n",Filter[i].Name, Filter[i].RegExp,Filter[i].Name);
  90.             Filter[i].Name=NULL;
  91.             continue;
  92.         }
  93. /*printf("Line %d: Filter[i].Name=%s Filter[i].RegExp=%s\n",line,Filter[i].Name,Filter[i].RegExp);*/
  94.         Filter[i].Selected=True;
  95.         Filter[i].count=0;
  96.         if ( i++ >= MAXFILTERS ) {
  97.             fprintf(stderr,"TOO MANY FILTERS in FILTER FILE %s (MAX=%d)\nIgnoring the rest\n",Filter_File, MAXFILTERS);
  98.             break;
  99.         }
  100.     }    
  101.     fclose(stream);
  102. }
  103.  
  104. char *PrintTimeStamp( TimeStamp )
  105. long TimeStamp;
  106. {
  107. static char buffer[20];
  108. long TimeNow;
  109.  
  110.         switch( TimeStampFormat ) {
  111.         case LONGTIME:  return( ltoa( TimeStamp, buffer ) );
  112.                                 /*NOTREACHED*/
  113.         case HUMANTIME: sprintf(buffer,"%s_%s ",
  114.                                         _Day( TimeStamp ), _Time( TimeStamp ));
  115.                                 return( buffer );
  116.                                 /*NOTREACHED*/
  117.         case ELAPSEDMIN:        time( & TimeNow );
  118.                                 return( ltoa( (TimeNow-TimeStamp)/60, buffer) );
  119.                                 /*NOTREACHED*/
  120.         case ELAPSEDSEC:        time( & TimeNow );
  121.                                 return( ltoa( (TimeNow-TimeStamp), buffer ) );
  122.                                 /*NOTREACHED*/
  123.         default:                return("BADCALL");
  124.                                 /*NOTREACHED*/
  125.         }
  126. }
  127.  
  128. Update()
  129. {
  130. FILE *stream;
  131. char buffer[100];
  132.  
  133.         if ( FileChanged( CycleTime_File, &cycletimelasttime) ) {
  134.                 XmTextSetString( cycletime, "READ.");
  135.                 if ((stream=fopen(CycleTime_File,"r"))==NULL)
  136.                         syserr("update_time: CycleTime_File\n");
  137.                 fgets( buffer , sizeof(buffer), stream );
  138.                 fclose(stream);
  139.                 XmTextSetString( cycletime, buffer );
  140.                 FileChanged( CycleTime_File, &cycletimelasttime );
  141.         }
  142.         if ( FileChanged( Checking_File, &checkinglasttime) ) {
  143.                 XmTextSetString( checking, "READ.");
  144.                 if ((stream=fopen(Checking_File,"r"))==NULL)
  145.                         syserr("update_time: Checking_File\n");
  146.                 fgets( buffer , sizeof(buffer), stream );
  147.                 fclose(stream);
  148.                 XmTextSetString( checking, &buffer[11] );
  149.                 FileChanged( Checking_File, &checkinglasttime );
  150.         }
  151.  
  152.     Problem_Manager( CHECK, NULL, NULL, NULL, NULL );
  153.  
  154.     CreateProblemXmStrings();
  155. }
  156.  
  157. /*
  158.  *    update_time - Update our Myclock once a minute
  159.  */
  160. void update_time( w, id )
  161. Widget w;
  162. XtIntervalId id;
  163. {
  164. long tloc, rounded_tloc, next_minute;
  165.  
  166.     time(&tloc);
  167.     rounded_tloc = tloc / 60 * 60;
  168. /*printf("ctime=%s\n",ctime(&rounded_tloc) );*/
  169.  
  170.     XmTextSetString( w , ctime(&rounded_tloc) );
  171.  
  172.     Update();
  173.  
  174.     next_minute = (60 - tloc % 60) * 1000;
  175.     XtAddTimeOut( next_minute, update_time, w );
  176. }
  177.  
  178. /*
  179.  *    List - Gets executed when user clicks on list entry
  180.  */
  181. void List( w , client_data, call_data )
  182. Widget w;
  183. caddr_t client_data;
  184. XmListCallbackStruct *call_data;
  185. {
  186. char *buffer;
  187.  
  188.     printf("List callback\n");
  189.     if (XmStringGetLtoR(call_data->item, XmSTRING_DEFAULT_CHARSET, &buffer))
  190.         printf(buffer);
  191.     else
  192.         printf("Unrecognized charset");
  193.     printf("\n");
  194. }
  195. /*
  196.  *    FilterNetCallback - User selected one of the Toggle Buttons
  197.  */
  198. void FilterNetCallback( w , client_data, call_data )
  199. Widget w;
  200. caddr_t client_data;
  201. XmListCallbackStruct *call_data;
  202. {
  203. Arg myArgs[10];
  204. int i;
  205.  
  206.     /* Get toggle button states! */
  207.     for( i=0; Filter[i].Name!=NULL; i++ ) {
  208.         XtSetArg( myArgs[0], XmNset, &Filter[i].Selected );
  209.         XtGetValues( Filter[i].Toggle,  myArgs, 1 );
  210.     }
  211.     CreateProblemXmStrings();
  212. }
  213. /*
  214.  *    Filter - Actual Filter Routine ( called for each problem entry 
  215.  */
  216. int FilterProblem( p )
  217. struct ProblemType *p;
  218. {
  219. extern char *regex();
  220. int i;
  221.  
  222.     for( i=0; Filter[i].Name!=NULL; i++ ) {
  223.         if ( regex( Filter[i].Pattern, p->Name ) != NULL ) {
  224.             Filter[i].count++;
  225.             if ( Filter[i].Selected==False) {
  226.                 printf("Filtered out %s Node %s\n", Filter[i].Name, p->Name);
  227.                 return(0);
  228.             }
  229.             else return(1); /* Matches pattern -user wants to see */
  230.         }
  231.         else;    /* See if we match the next one */
  232.     }
  233.     return(1);    /* No Match - user wants to see */
  234. }
  235.  
  236. #define NUMTEXTENTRIES (sizeof(text)/sizeof(char *))
  237.  
  238. CreateProblemXmStrings()
  239. {
  240. static int virgin=1;
  241. char buffer[100];
  242. int i;
  243. Cardinal n;
  244. Arg myArgs[10];
  245. extern char *itoa();
  246. extern struct ProblemType ProblemArray[];/*In Coreversion of existing problems*/
  247. extern int NumProblems;
  248.  
  249.  
  250.     XtSetArg( myArgs[0], XmNlistItems, NULL );
  251.     XtSetArg( myArgs[1], XmNlistItemCount, 0 );
  252.     XtSetValues( lista, myArgs, 2 );
  253.     if ( virgin ) {
  254.           ProblemEntries = (XmString *) XtMalloc(sizeof(XmString) * MAXPROBLEMS );
  255.         virgin=0;
  256.     }
  257.     for( i=0; Filter[i].Name!=NULL; i++ ) Filter[i].count=0;
  258.       for(n=0,i=0; i < NumProblems; i++ ) {
  259.         if ( FilterProblem( &ProblemArray[i] ) == 1 ) {
  260.             sprintf(buffer,"%s %s %s %s ",PrintTimeStamp(ProblemArray[i].TimeStamp),
  261.                 ProblemArray[i].Name,ProblemArray[i].UniqueID,
  262.                     ProblemArray[i].TestName);
  263.             while( strlen(buffer) < STATUSX ) strcat(buffer," ");
  264.             if ( ProblemArray[i].StatusLine[0] != '\0' )
  265.                 strcat( buffer, ProblemArray[i].StatusLine );
  266.                 ProblemEntries[n++] = XmStringCreate( buffer, XmSTRING_DEFAULT_CHARSET);
  267.         }
  268.     }
  269.     ProblemEntries[n]=NULL;
  270.     XtSetArg( myArgs[0], XmNlistItems, ProblemEntries );
  271.     XtSetArg( myArgs[1], XmNlistItemCount, n );
  272.     XtSetValues( lista, myArgs, 2 );
  273.     
  274.     XmTextSetString( numproblems, itoa( i, buffer ) );
  275.  
  276.         for( i=0; Filter[i].Name!=NULL; i++ ) 
  277.         XmTextSetString(  Filter[i].Count, itoa( Filter[i].count, buffer ));
  278. }
  279.  
  280. void ListaApplyCallback( w , client_data, call_data )    /* We label it Read Problem File */
  281. Widget w;
  282. caddr_t client_data;
  283. XtCallbackList *call_data;
  284. {
  285.     Update();
  286. }
  287.  
  288. void ListaCancelCallback( w , client_data, call_data )
  289. Widget w;
  290. caddr_t client_data;
  291. XtCallbackList *call_data;
  292. {
  293. char *text;
  294. XmString xmstr;
  295. Arg myArgs[10];
  296.  
  297.     printf("Cancel\n");
  298.     XtSetArg( myArgs[0], XmNtextString, &xmstr );
  299.     XtGetValues( w, myArgs, 1 );
  300.     if (XmStringGetLtoR( xmstr, XmSTRING_DEFAULT_CHARSET, &text ) != True)
  301.         printf("Cancel: Error getting label\n");
  302.     else
  303.         if ( text!=NULL ) printf("text was =%s\n",text);
  304.     xmstr=XmStringCreate( "" , XmSTRING_DEFAULT_CHARSET);
  305.     XtSetArg( myArgs[0], XmNtextString, xmstr );
  306.     XtSetValues( w, myArgs, 1 );
  307.     XmListDeselectAllItems(w);
  308. }
  309.  
  310. char *FindHelpFile( UniqueID )
  311. char *UniqueID;
  312. {
  313. FILE *stream;
  314. char buf[100],*p;
  315. static char helpfile[100];
  316.  
  317.     if ((stream = fopen( Host_File, "r" ))==NULL) {
  318.         fprintf(stderr,"FindHelpFile: Error opening hostfile %s\n",Host_File);
  319.         return(NULL);
  320.     }
  321.     while( fgets( buf, sizeof(buf), stream ) != NULL ) {
  322.         if (buf[0]=='#') continue;
  323.         p=strtok(buf," \t\n"); if (p==NULL) continue;/*Name*/
  324.         p=strtok(NULL," \t\n");if (p==NULL) continue; /*IP*/
  325.         if (strcmp(p,UniqueID)==0) {
  326.             fclose(stream);
  327.             p=strtok(NULL," \t\n");if (p==NULL) continue; /* Helpfilename*/
  328.             strcpy(helpfile,p);
  329.             return(helpfile);
  330.         }
  331.     }
  332.     fprintf(stderr,"FindHelpFile: Couldn't match %s in %s\n",UniqueID, Host_File);
  333.     fclose(stream);
  334.     return(NULL);
  335. }
  336.  
  337. void HelpDone( w , client_data, call_data )    /* We label it Read Problem File */
  338. Widget w;
  339. caddr_t client_data;
  340. XtCallbackList *call_data;
  341. {
  342.     printf("help done\n");
  343. }
  344.  
  345. void ListaHelpCallback( w , client_data, call_data )    /* We label it Read Problem File */
  346. Widget w;
  347. caddr_t client_data;
  348. XtCallbackList *call_data;
  349. {
  350. char *text,*helpfile,Help_File[100],*p;
  351. XmString xmstr;
  352. Arg myArgs[10];
  353. Widget done, helptext;
  354. Cardinal n;
  355. struct stat stbuf;
  356. int fd;
  357.  
  358.     printf("Help\n");
  359.     XtSetArg( myArgs[0], XmNtextString, &xmstr );
  360.     XtGetValues( w, myArgs, 1 );
  361.     if (XmStringGetLtoR( xmstr, XmSTRING_DEFAULT_CHARSET, &text ) != True)
  362.         printf("Cancel: Error getting label\n");
  363.     else
  364.         if ( text!=NULL )printf("text was =%s\n",text);
  365.     xmstr=XmStringCreate( "" ,  XmSTRING_DEFAULT_CHARSET);
  366.     XtSetArg( myArgs[0], XmNtextString, xmstr );
  367.     XtSetValues( w, myArgs, 1 );
  368.  
  369.     p=strtok(text," \t\n"); if (p==NULL) return;/*Day*/
  370.     p=strtok(NULL," \t\n");if (p==NULL) return; /*Name*/
  371.     p=strtok(NULL," \t\n");if (p==NULL) return; /*UniqueID*/
  372.     if (( helpfile = FindHelpFile(p))==NULL)
  373.         fprintf(stderr,"No Help File Available for %s\n",p);
  374.     else {
  375.         strcpy(Help_File,helpfile);
  376.         printf("HelpFile=%s\n",Help_File);
  377.  
  378.         if ( stat( Help_File, &stbuf ) == -1 ) {
  379.             fprintf(stderr,"Help File %s Not found\n", Help_File );
  380.             return;
  381.         }
  382.         helptextstr=XtMalloc( stbuf.st_size +100 );
  383.         if ( ( fd = open( Help_File, O_RDONLY) ) == -1 ) {
  384.                     fprintf(stderr,"Help File %s Not found\n", Help_File );
  385.                         return;
  386.         }
  387.         if ( ( read( fd, helptextstr,  stbuf.st_size ) ) < 0 ) {
  388.                         fprintf(stderr,"Help File %s : Error during Read\n", Help_File );
  389.             close( fd );
  390.                         return;
  391.         }
  392.         close( fd );
  393.  
  394.         n=0;
  395.         XtSetArg( myArgs[n], XmNx, 0 );    n++;
  396.         XtSetArg( myArgs[n], XmNy, 0 );    n++;
  397.         helpdialog = XmCreateBulletinBoardDialog( lista,    /* parent */
  398.                     "helpdialog",
  399.                     myArgs, n );
  400.         XtManageChild( helpdialog );
  401.  
  402.         n=0;
  403.         XtSetArg( myArgs[n], XmNx, 0 );    n++;
  404.         XtSetArg( myArgs[n], XmNy, 0 );    n++;
  405.         XtSetArg( myArgs[n], XmNcolumns, 40 );    n++;
  406.         XtSetArg( myArgs[n], XmNrows, 24 );    n++;
  407.         XtSetArg( myArgs[n], XmNeditable, False );    n++;
  408.         XtSetArg( myArgs[n], XmNeditMode, XmMULTI_LINE_EDIT); n++;
  409.         helptext = XmCreateScrolledText( helpdialog,
  410.                     "helptext",
  411.                       myArgs, n );
  412.         XtManageChild( helptext );
  413.         XmTextSetString( helptext, helptextstr );
  414.  
  415.         done = XtCreateManagedWidget( "done", xmPushButtonWidgetClass, 
  416.                         helpdialog, myArgs, n );
  417.         XtAddCallback( done, XmNactivateCallback, HelpDone, NULL );
  418.     }
  419. }
  420.  
  421. void ListaOKCallback( w , client_data, call_data )    /* We label it Read Problem File */
  422. Widget w;
  423. caddr_t client_data;
  424. XtCallbackList *call_data;
  425. {
  426. char *text, addr[MAXUNIQUEID],service[MAXTESTNAME], dummy[100], Name[100];
  427. XmString xmstr;
  428. Arg myArgs[10];
  429. int i,p;
  430. extern struct ProblemType ProblemArray[];/*In Coreversion of existing problems*/
  431. extern int NumProblems;
  432.  
  433.     printf("OK-Update Status\n");
  434.     XtSetArg( myArgs[0], XmNtextString, &xmstr );
  435.     XtGetValues( w, myArgs, 1 );
  436.     if (XmStringGetLtoR( xmstr, XmSTRING_DEFAULT_CHARSET, &text ) != True)
  437.         printf("Cancel: Error getting label\n");
  438.     else
  439.         if ( text!=NULL )printf("text was =%s\n",text);
  440.     sscanf(text, "%s %s %s %s", dummy, Name, addr, service );
  441.     printf("%s %s %s\n",Name, addr,service);
  442.     if ( (p=Problem_Exists( addr, service, ProblemArray, NumProblems)) == -1 )
  443.         printf("PROBLEM NOT FOUND- ERR!\n");
  444.     else {    
  445.         printf("ProblemExists: #%d\n",p);
  446.         printf("NewProblemLine=%s\n",text);
  447.         printf("StatusLine=%s\n",&text[STATUSX]);
  448.         if ( strlen(&text[STATUSX]) > MAXSTATUSLINE )
  449.             text[STATUSX+MAXSTATUSLINE-1] = '\0';    /* Avoid BIG STATUS */
  450.  
  451.              Problem_Manager( UPDATE_PROBLEM, service, Name, addr,  &text[STATUSX] );
  452.     }
  453.     xmstr=XmStringCreate( "" , XmSTRING_DEFAULT_CHARSET);
  454.     XtSetArg( myArgs[0], XmNtextString, xmstr );
  455.     XtSetValues( w, myArgs, 1 );
  456.     Update();
  457. }
  458.  
  459. Quit( w , client_data, call_data )
  460. Widget w;
  461. caddr_t client_data;
  462. XtCallbackList *call_data;
  463. {
  464.     exit(1);
  465. }
  466.  
  467. char *programname;
  468.  
  469. main(argc, argv)
  470.     int   argc;
  471.     char *argv[];
  472. {
  473.   Widget toplevel, mainwindow, commands;
  474.   Widget quit, selectfilter,programtitle;
  475.   Widget cycletimelabel, collectorstatus, collectorstatuslabel, numproblemslabel;
  476.   Arg myArgs[10];
  477.   XmString *TextEntries;
  478.   Cardinal n;
  479.   int i;
  480.  
  481.     programname=argv[0];
  482.  
  483.     if ((pingkydir=getenv("PINGKYDIR"))==NULL) pingkydir=DefaultPingkyDir;
  484.  
  485.     strcpy(Problem_File,pingkydir); strcat(Problem_File ,"/PROBLEM.FILE");
  486.     strcpy(Checking_File,pingkydir); strcat(Checking_File,"/CHECKING");
  487.     strcpy(CycleTime_File,pingkydir); strcat(CycleTime_File,"/pingky.cycle");
  488.     strcpy(Log_File,pingkydir); strcat(Log_File,"/problemlog");
  489.     strcpy(Host_File,pingkydir); strcat(Host_File,"/hostfile");
  490.     strcpy(Filter_File,pingkydir); strcat(Filter_File,"/pingky.filter");
  491.  
  492.  
  493.     SetupFilters();
  494.  
  495.  
  496.   /*
  497.    * Initialize the Intrinsics, create one TopLevelShell.
  498.    */
  499.   toplevel = XtInitialize(argv[0], "XDisplay", NULL, 0, 
  500.                           &argc, argv);
  501.  
  502.   n=0;
  503.   XtSetArg( myArgs[n], XmNwidth, 400); n++;
  504.   XtSetArg( myArgs[n], XmNheight, 100); n++;
  505.   mainwindow = XtCreateManagedWidget( "mainwindow", xmBulletinBoardWidgetClass, toplevel, myArgs, n );
  506.  
  507. /*
  508.     commands
  509. */
  510.   programtitle = XtCreateManagedWidget( "progtitle", xmLabelWidgetClass, mainwindow, NULL, 0);
  511.   Myclock = XtCreateManagedWidget( "clock", xmTextWidgetClass, mainwindow,NULL,0 );
  512.  
  513.   commands = XtCreateManagedWidget( "commands", xmRowColumnWidgetClass, mainwindow, NULL, 0 );
  514.   problemcounts = XtCreateManagedWidget("problemcounts", xmRowColumnWidgetClass, mainwindow, NULL, 0 );
  515.   selectfilter = XtCreateManagedWidget( "selectfilter", xmLabelWidgetClass, commands, NULL, 0);
  516.   XtSetArg( myArgs[0], XmNset, True );
  517.  
  518.   for( i=0; Filter[i].Name != NULL; i++ ) {
  519.       Filter[i].Toggle = XtCreateManagedWidget(Filter[i].Name, xmToggleButtonWidgetClass, commands, myArgs, 1 );
  520.       XtAddCallback( Filter[i].Toggle, XmNvalueChangedCallback, FilterNetCallback, NULL );
  521.       Filter[i].Count= XtCreateManagedWidget(Filter[i].Name, xmTextWidgetClass, problemcounts, NULL, 0 );
  522.   }
  523.   quit = XtCreateManagedWidget("quit", xmPushButtonWidgetClass, commands, NULL, 0 );
  524.   XtAddCallback( quit, XmNactivateCallback, Quit, NULL );
  525.  
  526. /*
  527.     collector status 
  528. */
  529.   collectorstatus = XtCreateManagedWidget( "collectorstatus", 
  530.             xmBulletinBoardWidgetClass, mainwindow, NULL, 0 );
  531.   collectorstatuslabel = XtCreateManagedWidget( "collectorstatuslabel", 
  532.             xmLabelWidgetClass, collectorstatus, NULL, 0 );
  533.   numproblemslabel= XtCreateManagedWidget( "numproblemslabel", 
  534.             xmLabelWidgetClass, collectorstatus, NULL, 0 );
  535.   checkinglabel = XtCreateManagedWidget( "checkinglabel", 
  536.             xmLabelWidgetClass, collectorstatus, NULL, 0 );
  537.   n=0;
  538.   XtSetArg( myArgs[n], XmNeditable, False ); n++;
  539.  
  540.   numproblems =  XtCreateManagedWidget( "numproblems", xmTextWidgetClass, collectorstatus,myArgs,n );
  541.   cycletimelabel =  XtCreateManagedWidget( "cycletimelabel", xmLabelWidgetClass, collectorstatus,NULL,0 );
  542.   cycletime =  XtCreateManagedWidget( "cycletime", xmTextWidgetClass, collectorstatus,myArgs,1 );
  543.   checking =  XtCreateManagedWidget( "checking", xmTextWidgetClass, collectorstatus,myArgs,1 );
  544. /*
  545.     list of problems
  546. */
  547.   /*TextEntries = (XmString *) XtMalloc(sizeof(XmString) * NUMTEXTENTRIES);
  548.   for(i=0;i<NUMTEXTENTRIES;i++)
  549.     TextEntries[i] = XmStringCreate( text[i], XmSTRING_DEFAULT_CHARSET);    */
  550.  
  551.   n=0;
  552. /*  XtSetArg( myArgs[n], XmNlistItems, TextEntries ); n++;
  553.   XtSetArg( myArgs[n], XmNlistItemCount, NUMTEXTENTRIES ); n++;*/
  554.   XtSetArg( myArgs[n], XmNscrollBarDisplayPolicy, XmCONSTANT); n++;
  555.   XtSetArg( myArgs[n], XmNlistSizePolicy, XmCONSTANT); n++;
  556. /*  XtSetArg( myArgs[n], XmNmustMatch, True ); n++;    /* Text selections MUST match */
  557.   lista = XmCreateSelectionBox( mainwindow, "lista", myArgs, n );
  558.   XtManageChild(lista);
  559.   XtAddCallback( lista, XmNapplyCallback, ListaApplyCallback, NULL );
  560.   XtAddCallback( lista, XmNcancelCallback, ListaCancelCallback, NULL );
  561.   XtAddCallback( lista, XmNhelpCallback, ListaHelpCallback, NULL );
  562.   XtAddCallback( lista, XmNokCallback, ListaOKCallback, NULL );
  563.   
  564.   update_time( Myclock, NULL );
  565.  
  566.   XtRealizeWidget(toplevel);
  567.   XtMainLoop();
  568. }
  569.